import java.io.IOException;
import java.net.DatagramSocket;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86136
 * Date: 2025-05-05
 * Time: 11:36
 */
public class UpdDictServer extends UdpEchoServer{
    private Map<String,String> dictionary = new HashMap<>();
    public UpdDictServer(int port) throws SocketException {
        super(port);
        dictionary.put("小猫","cat");
        dictionary.put("小狗","dog");
        dictionary.put("小熊","bear");
    }
    @Override
    public String possess(String request) {
        return dictionary.getOrDefault(request,"没有找到该词条");
    }

    public static void main(String[] args) throws IOException {
        UpdDictServer dictServer = new UpdDictServer(9090);
        dictServer.start();
    }
}
